import requests
import execjs

with open('DecryptCode.js',mode='r',encoding='utf-8') as file:
    jsFile = file.read()

ctx = execjs.compile(jsFile)


cookies = {
    'Hm_lvt_b1b4b9ea61b6f1627192160766a9c55c': '1725320838,1725759437,1726474399,1726557360',
    'HMACCOUNT': 'E3DA92CCA15F8725',
    'Hm_lpvt_b1b4b9ea61b6f1627192160766a9c55c': '1726557366',
}

headers = {
    'Accept': 'application/json, text/plain, */*',
    'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
    'Connection': 'keep-alive',
    # 'Cookie': 'Hm_lvt_b1b4b9ea61b6f1627192160766a9c55c=1725320838,1725759437,1726474399,1726557360; HMACCOUNT=E3DA92CCA15F8725; Hm_lpvt_b1b4b9ea61b6f1627192160766a9c55c=1726557366',
    'Referer': 'https://jzsc.mohurd.gov.cn/data/company',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0',
    'accessToken': '',
    'sec-ch-ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Microsoft Edge";v="122"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'timeout': '30000',
    'v': '231012',
}

response = requests.get(
    'https://jzsc.mohurd.gov.cn/APi/webApi/dataservice/query/comp/list?pg=0&pgsz=15&total=0',
    cookies=cookies,
    headers=headers
)
webData = response.text
# print(webData)
result = ctx.call('getDencyptData',webData)
print(result)